<?php
ob_start();
session_start();
include_once("../UserIncludes/DbConfig.php");
set_magic_quotes_runtime(1);
if(strpos($_REQUEST[adspaceid],','))
{
	$favId = substr($_REQUEST[adspaceid],0,strlen($_REQUEST[adspaceid])-1);
	
	
	$explode_favId = explode(',',$favId);
	$j=0;
	for($i=0;$i<count($explode_favId);$i++)
	{
		
		$sql = "delete from ".FAVADSPACE." where favId='".$explode_favId[$i]."'";
			$j++;
			mysql_query($sql);
		
	}
	echo '<div style="width:750px;height:40px;border:#999999 thin solid; vertical-align:middle;" class="err_class"><br>'.$j.' adspace(s) has been removed from your favourite list</div>';
}
else
{
$fetSpaceId = mysql_fetch_array(mysql_query("select adspaceId from adspace_favourites where favId='".$_REQUEST[adspaceid]."'"));
$adspid = $fetSpaceId[0];
 $sql = "delete from ".FAVADSPACE." where favId='".$_REQUEST[adspaceid]."'";

			mysql_query($sql);


	echo '<script>window.location="../adSpaceDetails.php?deletefav=yes&id='.$adspid.'"</script>';
}


?>

